UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sG4fs0gMkmoMhXP3gMxt4oP9y2xxQiQqIlRB5eSZGu0='
WHERE
key_id = '13c213b50c7cea3232c08631d9b0c0357396127a964eaa960b9e7fc61586544c'
AND (
token = 'sG4fs0gMkmoMhXP3gMxt4oP9y2xxQiQqIlRB5eSZGu0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)