UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bAUpYKzxHJ/SPDS2jgWESnHWDinG9zWutT/aoadS3bo='
WHERE
key_id = 'dd83ebaff9208900460cc1f01ed5471875ade292a4d342e8cbac358f4cee13ec'
AND (
token = 'bAUpYKzxHJ/SPDS2jgWESnHWDinG9zWutT/aoadS3bo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)