UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pHzlW7vdar8QVM1SYPUhTX57wPHg1rjYY23MLlt7y2k=' 
WHERE 
  key_id = '51c44d5a2454bcade52f0142671bf2b37036e89a67c320d28549c3e4a998e99a' 
  AND (
    token = 'pHzlW7vdar8QVM1SYPUhTX57wPHg1rjYY23MLlt7y2k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039