UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HIYx9Cz0HjtQi/P4Z6QPYCb9AT+vqFV4+TLogriDRRs=' 
WHERE 
  key_id = '61529eef5c385f9df527dbb41a91be14c26269f46ac88e0f1ec9d7d787f25317' 
  AND (
    token = 'HIYx9Cz0HjtQi/P4Z6QPYCb9AT+vqFV4+TLogriDRRs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016