UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J+nFDWX94XGkl69mJGr0TWuxt1zHJJA0fyZMbBy6n44='
WHERE
key_id = '0872af2e76f941ec0dd46773b4514c71683a8a1d2fdb273fda33fe57091300fc'
AND (
token = 'J+nFDWX94XGkl69mJGr0TWuxt1zHJJA0fyZMbBy6n44='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)