UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9Tt0+TqCQTWuOj+QvkHwacTZqiHuXPLSzIOfvPR6/bQ=' 
WHERE 
  key_id = '8c7f31a746288d772e967f5c3a8ea91f7b93d4eaf8cec9ca8c21888b072a02e4' 
  AND (
    token = '9Tt0+TqCQTWuOj+QvkHwacTZqiHuXPLSzIOfvPR6/bQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041