UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WI1GJtDK94T/Sj15/LH/ZADeafiBcLqL7BWgQ4aPcPg=' 
WHERE 
  key_id = '931075bd4335bfb062cc1a6874ce4864fde2ac2080f32017b2a0a6f5fce75277' 
  AND (
    token = 'WI1GJtDK94T/Sj15/LH/ZADeafiBcLqL7BWgQ4aPcPg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035