UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '40YdQuMnxUqJbxb6CS0HJElNxgGpYdqI1SgifMX9lhA='
WHERE
key_id = '3bb6ff1e26fe056aa7a084ced224467853cb4ddb5503381d8067bbc99a40b11f'
AND (
token = '40YdQuMnxUqJbxb6CS0HJElNxgGpYdqI1SgifMX9lhA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)