UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YVC2a2pJdAF7S/AgKy4bRwkmPIF93jkWUWxSIq6DPNc=' 
WHERE 
  key_id = 'fe9604da0a08c8e3300e589f228e52bd4218fd08b707df0cb235de82e225aaab' 
  AND (
    token = 'YVC2a2pJdAF7S/AgKy4bRwkmPIF93jkWUWxSIq6DPNc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038