UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kzKeEcCwWI+QqM+5uvZR0JfeOvTME+VHtHtZfV91GuY=' 
WHERE 
  key_id = 'a9353cd3333a2451fd563c34362e14e5f16b3809b9dd4c02a79961b1489f4439' 
  AND (
    token = 'kzKeEcCwWI+QqM+5uvZR0JfeOvTME+VHtHtZfV91GuY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030