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