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