UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NY+gP7IS2bSb6HtelkyII8Gy6Tiu4l+HDvxldeerHLo='
WHERE
key_id = 'cad5a4d537682b99f379ff7248a775a68e8addd41e086f8861515afc370016d1'
AND (
token = 'NY+gP7IS2bSb6HtelkyII8Gy6Tiu4l+HDvxldeerHLo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)