UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZCjA0xUh/9DVKEZqPyaCMsTJ08Jt0E2k4Qqf75Pn3gQ='
WHERE
key_id = '8eaa5b6c8261ee65e0cd15f82b822101840923271862eec54cf217a9689ec61a'
AND (
token = 'ZCjA0xUh/9DVKEZqPyaCMsTJ08Jt0E2k4Qqf75Pn3gQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)