UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RAJ5xm8TMpPl369LBSKOPaS0BHJmQjaj0JLGGtAhoFg=' 
WHERE 
  key_id = '6704d39d9e8b611a56a7d28e33babaac3be16d46190e1d4c8823773f43980416' 
  AND (
    token = 'RAJ5xm8TMpPl369LBSKOPaS0BHJmQjaj0JLGGtAhoFg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040