UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KbfesqLeNQPvnsYiaIYfAvmUwecNohC65dDNOVhtbZU='
WHERE
key_id = '05aa2db24d012915c073d4a142c0938a7a0be11b8910c092f2e580907fc2ce0c'
AND (
token = 'KbfesqLeNQPvnsYiaIYfAvmUwecNohC65dDNOVhtbZU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)