UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qydP/PR7cLCNj94EYsGBej54+ovGrWkcGf3cqMSH5f4=' 
WHERE 
  key_id = '0e55a9388fdfdd433750d51b1a9a5f44e32d69c1be0f5b810244133ec16c245c' 
  AND (
    token = 'qydP/PR7cLCNj94EYsGBej54+ovGrWkcGf3cqMSH5f4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042