UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gOoa1aA52kDVz8bJ6Izw8DIolBisNfB3yBKg9iRpSXA='
WHERE
key_id = 'd020282ec2b059ccf2719d8c7fe8d746474e8af3942ab7214e841c0e6ddedadf'
AND (
token = 'gOoa1aA52kDVz8bJ6Izw8DIolBisNfB3yBKg9iRpSXA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)