UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i6BzNy1r0LfrnNxwUj916/HFj84ozPYjqnelKOmqVxw='
WHERE
key_id = '1d8db9a5355fa92ede1420dea979789a5e44f5f7cfcefb8627055d831fef64e5'
AND (
token = 'i6BzNy1r0LfrnNxwUj916/HFj84ozPYjqnelKOmqVxw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)