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