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