UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7sF1YKZ+fJQnOooeA4y6GT7D5lz/YLbfXbCWAtin+RY='
WHERE
key_id = '5b9f644b3420a96acf267526e4ef82caa8889eeae55475600b3f5002b08f3824'
AND (
token = '7sF1YKZ+fJQnOooeA4y6GT7D5lz/YLbfXbCWAtin+RY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)