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