UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xTNJeA229h/vqCavfHg/6DbKlD7igixqPzgPHP1AeAs=' 
WHERE 
  key_id = 'da7d5cc502b31078c58344d43140aa96f9f3c8200233e2401494b818cefa2172' 
  AND (
    token = 'xTNJeA229h/vqCavfHg/6DbKlD7igixqPzgPHP1AeAs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028