UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rb5/U+74v6gtvBySVOqnwmJiO1ElLq7pI8zoGxY40xw='
WHERE
key_id = '4a65bfe78719210e751009b5f03cd39cd16a9ec13ff6926ee34337d83498cab1'
AND (
token = 'rb5/U+74v6gtvBySVOqnwmJiO1ElLq7pI8zoGxY40xw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)