UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NbgEh9ieTu3hzZAwjDb+E64icGwsalhmxnxQdrNtKkI='
WHERE
key_id = '542d56f76b1c7bfa13e67eabcdc2f1436305f90af4d8848d9dbb9df7df48c5d9'
AND (
token = 'NbgEh9ieTu3hzZAwjDb+E64icGwsalhmxnxQdrNtKkI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)