UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'l7RsPQgZs48wbQX3pPDiiNnAKSyQUJSXwBD6F3rbHwY='
WHERE
key_id = 'e6d0e40b2d6dae845ad8a3f36d9fe9ee90b0f0a6bb1263db9aa091d0b74d6164'
AND (
token = 'l7RsPQgZs48wbQX3pPDiiNnAKSyQUJSXwBD6F3rbHwY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)