UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ketgnBpOKT7r7Agj5O1hjvQqMnS5HsolDL5UwmVbMO4='
WHERE
key_id = '6e0549f38f1471f1e8df438eefa4e52270aed43f96687f8ff71b7fb5d77a4e69'
AND (
token = 'ketgnBpOKT7r7Agj5O1hjvQqMnS5HsolDL5UwmVbMO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)